package com.example.eeuse.config;

import etcd.watch.WatchClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;


@ConditionalOnProperty(value = "etcd.watch.enable",havingValue = "true",matchIfMissing = true )
@Configuration
public class EtcdWatchStarter {
    @Value("${etcd.server}")
    private String etcd;
    @Value("${spring.application.name:sample}")
    private String appName;

    @PostConstruct
    public void init() {
        WatchClient.Builder builder = new WatchClient.Builder();
        WatchClient starter = builder.setAppName(appName).setEtcdServer(etcd).build();
        starter.startPipeline();
    }

    public static void main(String[] args) {
        Map<String, HashSet<String>> totalSkuSet = new HashMap<>();
        System.out.println(totalSkuSet.get("a"));
    }

}
